<template>
  <div>
    <el-form-item v-if="showDesc" label="审批意见" :label-width="formlabelWidth">
      <input-description v-model="form.description"></input-description>
    </el-form-item>
    <el-form-item v-if="showUserSelect" :required="showUserSelect" label="处理人" :label-width="formlabelWidth">
      <select-assignee v-model="form.selectAssigneeList" :multiple="multiple"
                       :data="wfNode.nextUserList"></select-assignee>
    </el-form-item>
  </div>
</template>

<script>
  import wfStatusMixin from '@/mixins/wfStatusMixin'

  export default {
    name: "bpmn-form",
    components: {
      SelectAssignee: () => import('./select-assignee'),
      InputDescription: () => import('./input-description'),
    },
    mixins: [wfStatusMixin],
    model: {
      prop: 'data',
      event: 'change'
    },
    props: {
      businessId: {
        type: String,
        default: ''
      },
      procDefKey: { // 参数
        type: String,
        default: ''
      },
      url: {
        type: String,
        default: ''
      },
      formlabelWidth: {
        type: String,
        default: ''
      },
      entity: {
        type: Object,
        default: {
          show: false,
          type: 'build',
          params: {},
        },
      },
      needInit: {
        type: Boolean,
        default: true
      },
      variables: {
        type: Object,
        default: {
          show: false,
          type: 'build',
          params: {},
        },//当出现需要添加其他参数，并且不想在实体类里面添加可传入
      },
    },
    data() {
      return {
        form: {
          description: '',
          selectAssigneeList: []
        }
      }
    },
    mounted() {
      if(this.needInit){
        const params = {
          businessId: this.businessId,
          procDefKey: this.procDefKey,
          url: this.url,
          entity: this.entity,
          variables:this.variables
        }
        this.initNodeAttribute(params).then(() => {
          this.$emit('complete', this.wfNode)
        })
      }
    },
    methods: {
      getForm() {
        return this.form
      },
      // changeNodeAttribute
    }
  }
</script>

<style scoped>

</style>
